package cn.csc.module.product.dal.mysql.categorybrand;

import java.util.*;

import cn.csc.framework.common.pojo.PageResult;
import cn.csc.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.csc.framework.mybatis.core.mapper.BaseMapperX;
import cn.csc.module.product.dal.dataobject.categorybrand.CategoryBrandDO;
import org.apache.ibatis.annotations.Mapper;
import cn.csc.module.product.controller.admin.categorybrand.vo.*;

/**
 * 品牌分类关联信息 Mapper
 *
 * @author liuchuang
 */
@Mapper
public interface CategoryBrandMapper extends BaseMapperX<CategoryBrandDO> {

    default PageResult<CategoryBrandDO> selectPage(CategoryBrandPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CategoryBrandDO>()
                .eqIfPresent(CategoryBrandDO::getBrandId, reqVO.getBrandId())
                .eqIfPresent(CategoryBrandDO::getCategoryId, reqVO.getCategoryId())
                .betweenIfPresent(CategoryBrandDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CategoryBrandDO::getId));
    }

    default List<CategoryBrandDO> selectList(CategoryBrandExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<CategoryBrandDO>()
                .eqIfPresent(CategoryBrandDO::getBrandId, reqVO.getBrandId())
                .eqIfPresent(CategoryBrandDO::getCategoryId, reqVO.getCategoryId())
                .betweenIfPresent(CategoryBrandDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CategoryBrandDO::getId));
    }

}
